import type { DataTableProps } from "naive-ui";
import { NAvatar, NImage, NTag } from "naive-ui";
import { h } from "vue";
import RenderGender from "@/components/RenderGender.vue";
import { formatTime, renderMaybeNull } from "@/utils";
import { AUTH_TYPE_MAP, USER_AUTH_STATUS_MAP, USER_AUTH_STATUS_MAP_COLOR } from '@/const/user'

export const complaintColumns: DataTableProps["columns"] = [
	{
		title: '订单ID',
		key: 'orderId',
		width: 180
	},
    {
        title: '处理状态',
        key: 'status',
        width: 100,
        render: (row: any) => {
            const statusMap: Record<number, { label: string; type: 'success' | 'error' | 'default' }> = {
                0: { label: '未处理', type: 'default' },
                1: { label: '已处理', type: 'success' },
                2: { label: '已作废', type: 'error' }
            }
            const { label, type } = statusMap[row.status] || { label: '未知', type: 'error' }

            return h(
                NTag,
                { type, round: true, size: 'small' },
                { default: () => label }
            )
        }
    },
    {
        title: '用户名',
        key: 'userName',
        width: 120
    },
    {
        title: '用户手机',
        key: 'userPhone',
        width: 120
    },
    {
        title: '投诉原因',
        key: 'reason',
        ellipsis: {
            tooltip: true
        },
        width: 220
    },
    {
        title: '诉求',
        key: 'demand',
        ellipsis: {
            tooltip: true
        },
        width: 220
    },

    {
        title: '处理反馈',
        key: 'operResult',
        ellipsis: {
            tooltip: true
        },
        width: 220
    },
    {
        title: '处理人',
        key: 'operBy',
        width: 100
    },
    {
        title: '处理时间',
        key: 'operTime',
        width: 180,
        render: (row: any) => row.operTime ? formatTime(row.operTime, 'YYYY-MM-DD HH:mm:ss') : ''
    },
	{
		title: '创建时间',
		key: 'createTime',
		width: 180,
		render: (row: any) => row.createTime ? formatTime(row.createTime, 'YYYY-MM-DD HH:mm:ss') : ''
	}
]


